package com.freecat.xmqgct.mvp.ui.fragment;


import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.freecat.xmqgct.R;
import com.freecat.xmqgct.mvp.ui.adapter.AttendInfoAdapter;
import com.freecat.xmqgct.view.MyListView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.jessyan.art.mvp.IPresenter;

public class AttendInfoFrag extends BaseFragment {


    /**
     * ================================================
     * Description:
     * 人员到场情况列表
     * lj
     * 2019/9/19
     * ================================================
     */


    @BindView(R.id.lv_attendinfo)
    MyListView lvAttendinfo;
    AttendInfoAdapter attendInfoAdapter;
    private int type = 0;
    Unbinder unbinder;

    @Override
    public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return LayoutInflater.from(mContext).inflate(R.layout.fragment_attendinfo, null);
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        type = getArguments().getInt("type");
        setAdapter();

    }

    private void setAdapter() {

        if (type == 0) {
            attendInfoAdapter = new AttendInfoAdapter(mContext, 0);
        } else {
            attendInfoAdapter = new AttendInfoAdapter(mContext, 1);
        }
        lvAttendinfo.setAdapter(attendInfoAdapter);

    }


    @Nullable
    @Override
    public IPresenter obtainPresenter() {
        return null;
    }

    @Override
    public void setData(@Nullable Object data) {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}